package com.atrix.CinemaView.pojo;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class Container<T extends FileObj> implements Comparable<Container<T>> {
    // 容器的名称
    private String name;
    // 容器包含的文件数量
    private int size;
    // 容器包含的文件对象
    private List<T> data;
    
    public Container(String name) {
        this.size = 0;
        this.name = name;
        this.data = new ArrayList<>();
    }
    
    public void addFile(T file) {
        this.size++;
        this.data.add(file);
    }
    
    @Override
    public int compareTo(Container o) {
        return this.getName().compareTo(o.getName());
    }
}
